package com.mc.string;

public class StringRotation {
    public String rotateString(String A, int n, int p) {
        // write code here
    	
        String s1 = sup(A,0,n-1);
        String s2 = sup(s1,0,n-p-2);
        String s3 = sup(s2,n-p-1,n-1);
        
        return s3;
    }
    public String sup(String A,int low,int high){
        
        StringBuilder sb = new StringBuilder(A);
        while(low<high){
			char ch = sb.charAt(low);
            sb.setCharAt(low,sb.charAt(high));
            sb.setCharAt(high,ch);
            low++;
            high--;
        }
        return sb.toString();
    }
}
